{% extends 'layout.html' %}

{% block content %}

    <div class="container">
        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title"> {{ title }} </h3>
            </div>
            <div class="panel-body">
                <form method="post" novalidate >
                    {% csrf_token %}

                    {% for field in form %}
                        <div class="form-group">
                            <label>{{ field.label }}</label>
                            {{ field }}
                            {% if field.errors %}
                                <span style="color: red;">
                                    {% for error in field.errors %}
                                        {{ error }}<br>
                                    {% endfor %}
                                </span>
                            {% endif %}
                        </div>
                    {% endfor %}

                    <button type="submit" class="btn btn-primary">提 交</button>

                    {% if form.non_field_errors %}
                        <div style="color: red;">
                            {% for error in form.non_field_errors %}
                                {{ error }}<br>
                            {% endfor %}
                        </div>
                    {% endif %}
                </form>
            </div>
        </div>
    </div>

{% endblock %}